package com.liang.ui;



import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


/**
 * @ClassName ChoosesUI
 * @Description TODO
 * @Author liang
 * @Date 2019/7/8 12:38
 * @Version 1.0
 **/
public class ChoosesUI  extends JFrame {
    //定义组件
    JPanel jPanel;
    JScrollPane jScrollPane;
    JButton emailBt;
    JButton copydBt;
    JTextArea textArea;
    public static final String extensively = "友情提示\n"
            + "1. 获取邮件内容,输入邮箱用户名密码登录,导出当天邮件到D盘\n"
            + "2. 合并邮件文件用于收集邮件统计人员,提取多个excel中当天的邮件内容,并生成excel\n"
            ;

    public ChoosesUI(){
        jPanel = new JPanel();
        textArea = new JTextArea();
        jScrollPane = new JScrollPane(textArea);
        emailBt = new JButton("获取邮件内容");
        copydBt = new JButton("合并邮件文件");

        //说明
        textArea.setText(extensively);


        jPanel.add(emailBt);
        jPanel.add(copydBt);

        //布局
        this.add(jScrollPane);
        this.add(jPanel, BorderLayout.SOUTH);
        this.setSize(800, 600);
        this.setTitle("email处理工具");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
        //监听按钮
        action();

    }

    private void action() {
        emailBt.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new LoginEmail();//登录邮箱入口
            }
        });

        copydBt.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                new ExcelCopyUI();//拷贝excel入口
            }
        });
    }


}
